package com.kaili.basic.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.kaili.basic.mapper.OrgMapper;
import com.kaili.basic.pojo.dto.MdmOrgQueryByPageDto;
import com.kaili.basic.pojo.dto.MdmOrgQueryDto;
import com.kaili.basic.pojo.entity.MdmOrgEntity;
import com.kaili.basic.pojo.vo.MdmOrgQueryAllVo;
import com.kaili.basic.service.IMdmOrgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Desc: mdm组织机构service实现层
 * @author: TBS
 * @Time: 2019/8/1 18:50
 * @Copyright: © 2018 杭州凯立通信有限公司 版权所有
 * @Warning: 本内容仅限于公司内部传阅,禁止外泄或用于其它商业目的
 */
@Service
public class OrgServiceImpl implements IMdmOrgService {
    @Autowired
    private OrgMapper mdmOrgMapper;

    /**
    * @Desc: 分页查询
    * @author: TBS
    * @Time: 2019/8/9 14:59
    * @param page
    * @param mdmOrgQueryByPageDto
    * @return com.baomidou.mybatisplus.plugins.Page<com.kaili.basic.pojo.vo.MdmOrgQueryAllVo>
    */
    @Override
    public Page<MdmOrgQueryAllVo> queryPageList(Page<MdmOrgQueryAllVo> page, MdmOrgQueryByPageDto mdmOrgQueryByPageDto) {
        List<MdmOrgQueryAllVo> mdmOrgQueryAllVoList = mdmOrgMapper.queryPageList(page,mdmOrgQueryByPageDto);
        return page.setRecords(mdmOrgQueryAllVoList);
    }

    /**
    * @Desc: 增加
    * @author: TBS
    * @Time: 2019/8/9 14:59
    * @param mdmOrgEntity
    * @return void
    */
    @Override
    public void add(MdmOrgEntity mdmOrgEntity) {
        mdmOrgMapper.add(mdmOrgEntity);
    }

    /**
    * @Desc: 去重
    * @author: TBS
    * @Time: 2019/8/9 14:59
    * @param mdmOrgEntity
    * @return java.lang.Integer
    */
    @Override
    public Integer queryDprvOrg(MdmOrgEntity mdmOrgEntity) {
        return mdmOrgMapper.queryDprvOrg(mdmOrgEntity);
    }

    /**
    * @Desc:  修改
    * @author: TBS
    * @Time: 2019/8/9 15:00
    * @param mdmOrgEntity
    * @return void
    */
    @Override
    public void update(MdmOrgEntity mdmOrgEntity) {

        mdmOrgMapper.update(mdmOrgEntity);
    }

    /**
    * @Desc:  删除
    * @author: TBS
    * @Time: 2019/8/9 15:00
    * @param id
    * @return void
    */
    @Override
    public void delete(int id) {
        mdmOrgMapper.delete(id);
    }

    /**
    * @Desc:  查询数据库编号的最大值
    * @author: TBS
    * @Time: 2019/8/9 15:00
    *
    * @return java.lang.String
    */
    @Override
    public String getCode() {
        return mdmOrgMapper.getCode();
    }

     /**
     * @Desc:  查询Org表中的code和name
     * * @author: TBS
     * @Time: 2019/8/9 18:50
     *
     * @return com.kaili.basic.pojo.entity.MdmOrgEntity
     */
    @Override
    public List<MdmOrgEntity> getCodeName() {
        return mdmOrgMapper.getCodeName();
    }

    /**
    * @Desc:  导出
    * @author: TBS
    * @Time: 2019/8/9 15:00
    * @param mdmOrgQueryByPageDto
    * @return java.util.List<com.kaili.basic.pojo.vo.MdmOrgQueryAllVo>
    */
    @Override
    public List<MdmOrgQueryAllVo> queryOrgExport(MdmOrgQueryByPageDto mdmOrgQueryByPageDto) {
        return mdmOrgMapper.queryOrgExport(mdmOrgQueryByPageDto);
    }

    /**
    * @Desc:  条件查询mdm消息
    * @author: TBS
    * @Time: 2019/8/9 15:02
    * @param mdmOrgQueryDto
    * @return java.util.List<com.kaili.basic.pojo.entity.MdmOrgEntity>
    */
    @Override
    public List<MdmOrgEntity> queryOrgRanges(MdmOrgQueryDto mdmOrgQueryDto) {
        return mdmOrgMapper.queryOrgRanges(mdmOrgQueryDto);
    }

    /**
    * @Desc: 通过ID查详情
    * @author: TBS
    * @Time: 2019/8/9 15:01
    * @param id
    * @return com.kaili.basic.pojo.entity.MdmOrgEntity
    */
    @Override
    public MdmOrgEntity queryOrgById(int id) {
        return mdmOrgMapper.queryOrgById(id);
    }
}
